package myproject.sys.server;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import myproject.common.utils.IdGen;
import myproject.sys.dao.UserDao;
import myproject.sys.entity.User;

@Service
@Transactional(readOnly = true)
public class UserService {
	
	@Autowired
	private UserDao userDao;
	
    
    public List<User> selectUser(User user) {
        return userDao.selectUser(user);
    }

    public void insertUser(User user) {
        String userId = IdGen.uuid();
        if(user.getUserId()==null||user.getUserId()=="")
            user.setUserId(userId.replace("-", ""));
        System.out.println(user.getUserId());
        userDao.insertUser(user); 
    }

    public List<User> selectUserByUserName(String username) {
        return userDao.selectUserByUserName(username);        
    }
    

}
